#!/bin/sh
# installs apache2 and last version of mono (2.4.3) in ubuntu 8.04 default

# add key to repository
monorep=$(grep "deb http://directhex.mfgames.com/ hardy main" /etc/apt/sources.list)
if [ -z "$monorep" ];then
	wget -q -O- http://directhex.mfgames.com/directhex.ppa.asc | sudo apt-key add -
	echo "deb http://directhex.mfgames.com/ hardy main" >> /etc/apt/sources.list
	echo "source added to repository"
fi
apt-get update
aptitude -y install apache2 
aptitude -y install libapache2-mod-mono mono-apache-server2 
aptitude -y install asp.net2-examples 

# enable module
a2enmod mod_mono_auto
a2enmod mod_mono

# prepare asp.net site 
rm /var/www/index.html
cp -r /usr/share/asp.net2-demos/* /var/www/
path=/etc/mono-server2/debian.webapp
echo "<apps>" > $path
echo "	<web-application>" >> $path
echo "	<name>samples</name>" >> $path
echo "	<vpath>/</vpath>" >> $path
echo "  <path>/var/www</path>" >> $path 
echo "  <vhost>localhost</vhost>" >> $path
echo "  <port>80</port>" >> $path
echo "  </web-application>" >> $path
echo "</apps>" >> $path

# reload
/etc/init.d/apache2 restart


